-
Notifications
You must be signed in to change notification settings - Fork 20
feat: PEP 794 support #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1b525b5 to
097518f
Compare
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
097518f to
2f7c82d
Compare
Signed-off-by: Henry Schreiner <[email protected]>
abravalheri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much Henry
| duplicated = [k for k, v in (import_names + import_namespaces).items() if v > 1] | ||
|
|
||
| if duplicated: | ||
| raise ImportNameCollision( | ||
| message="Duplicated names are not allowed in import-names/import-namespaces", | ||
| value=duplicated, | ||
| name="data.project.importnames(paces)", | ||
| definition={ | ||
| "description": cleandoc(ImportNameCollision._DESC), | ||
| "see": ImportNameCollision._URL, | ||
| }, | ||
| rule="PEP 794", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the duplication check can be added to the JSONSchema itself, by leveraging uniqueItems.
There is variability around \s*;\s*private, so the check would not be 100% perfect (so the extra validation may still be needed), but it would make the JSON schema more useful on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do quite a bit more with the schema itself, and that's done in the SchemaStore version of the project table. For example, "dynamic" checking can be done via the schema. For this PR, the regex can be implemented too, so that the "format" only would add keyword checking. But I'd assume if you want these, you could use the SchemaStore versions, instead of pulling these out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there's not a way to makes sure it's unique across multiple arrays?
Adding support for PEP 794. (Inspired by pypa/packaging#948)
Also in SchemaStore/schemastore#5077 and pypa/pyproject-metadata#260.